package com.lagou.homework3.no4;

import java.util.List;

/**
 * 删除学生信息
 */
public class RemoveStudent {
    public static List remove(List list, int id){
        int result = 0;//记录删除操作是否成功
        for(int i=0;i<list.size();i++){
            Student stu = (Student) list.get(i);
            if(stu.getId()==id){//判断要修改的学生学号是否存在
                list.remove(stu);
                result++;
            }
        }
        if(result==0){
            System.out.println("您输入的学号信息不存在！");
        }
        return list;
    }
}
